package com.hanoiwiki.manager.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import com.hanoiwiki.dao.CoordinatesDAO;
import com.hanoiwiki.exception.DataAccessException;
import com.hanoiwiki.manager.CoordinatesManager;
import com.hanoiwiki.model.Coordinates;

@Component
@Transactional
public class CoordinatesManagerImpl extends BaseManagerImpl implements CoordinatesManager{
	@Autowired
	private CoordinatesDAO coordinatesDAO;

	@Override
	public void save(Coordinates coordinates) {
		try {
			coordinatesDAO.save(coordinates);
		} catch (DataAccessException e) {
			log.error("", e);
		}
	}

	@Override
	public void update(Coordinates coordinates) {
		try {
			coordinatesDAO.update(coordinates);
		} catch (DataAccessException e) {
			log.error("", e);
		}
	}

	@Override
	public Coordinates get(Integer id) {
		try {
			return coordinatesDAO.get(id);
		} catch (DataAccessException e) {
			log.error("", e);
		}
		return null;
	}

	@Override
	public List<Coordinates> getList() {
		try {
			return coordinatesDAO.getList();
		} catch (DataAccessException e) {
			log.error("", e);
		}
		return null;
	}

	@Override
	public void remove(Integer id) {
		try {
			coordinatesDAO.remove(id);
		} catch (DataAccessException e) {
			log.error("", e);
		}
	}
}
